-- Deleting Rows from a Table
DELETE FROM Production.ProductCostHistory
WHERE StandardCost > 1000.00;



-- Truncating a Table
SELECT COUNT(*) AS BeforeTruncateCount
FROM HumanResources.JobCandidate;
TRUNCATE TABLE HumanResources.JobCandidate;
SELECT COUNT(*) AS AfterTruncateCount
FROM HumanResources.JobCandidate;



-- Deleting Rows Based on Other Tables
DELETE FROM Sales.SalesPersonQuotaHistory
FROM Sales.SalesPersonQuotaHistory AS spqh
    INNER JOIN Sales.SalesPerson AS sp
    ON spqh.BusinessEntityID = sp.BusinessEntityID
WHERE sp.SalesYTD > 1000000.00;



-- Using the OUTPUT Clause with the DELETE Statement
DELETE Sales.ShoppingCartItem
    OUTPUT DELETED.*;
